<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex align-stretch benben-position-layout flex address_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex align-center justify-between flex-sub address_fd0_0'>
          <view class='flex align-center address_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
            <text class='fu-iconfont2  address_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex align-center'>
            <text class='address_fd0_0_c1_c0'>{{name}}</text>
          </view>
          <view class='flex align-center address_fd0_0_c0'>
          </view>
        </view>

      </view>

      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <view class="flex flex-direction align-stretch justify-center benben-position-layout flex commodityList_flex_1"
        :style="{top:(88+StatusBarRpx)+'rpx', }">
        <view class='flex align-center self-center justify-between flex-sub commodityList_fd1_0'>
          <view class='flex align-center'>

            <view class='flex align-center flex-sub commodityList_fd0_0_c1'>
              <text class='fu-iconfont2  commodityList_fd0_0_c1_c0' @tap.stop="topSearchFunc()">&#xe738;</text>
              <benben-input class='flex-sub commodityList_fd0_0_c1_c1' type="text" :placeholder="$t('请输入商品名称')"
                confirm-type="done" :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"
                @confirm="topSearchFunc()" v-model="keyword" />
              <image class='commodityList_fd0_0_c1_c2' mode="aspectFit" :src='STATIC_URL+"129.png"'
                @tap.stop="cleanKeywordFunc()" v-if="keyword!=''"></image>
            </view>

          </view>
          <view class='flex flex-wrap align-center'>
            <view class='flex flex-wrap align-center' @tap.stop="popupShow1696735753286=true">
              <text class='commodityList_fd1_0_c1_c0_c0'>{{$t('筛选')}}</text>
              <image class='commodityList_fd1_0_c1_c0_c1' mode="aspectFit" :src='STATIC_URL+"412.png"'></image>
            </view>
          </view>
        </view>

      </view>
      <view :style="{height: '100rpx'}"></view>
      <!---商品列表_商品1flex布局开始-->
      <view class="flex flex-wrap align-center benben-flex-layout commodityList_flex_2">
        <template v-for='(item,key0) in goods_List'>
          <view class='flex flex-direction flex-wrap align-stretch commodityList_fd2_0' @tap.stop="handleJumpDiy"
            data-type="navigateTo" :data-url="`/pages/fl/shopDetail/shopDetail?id=${item.aid}`" :key='key0'>
            <image class='commodityList_fd2_0_c0' mode="aspectFill" :src='item.thumb'></image>
            <text class='commodityList_fd2_0_c1'>{{item.name}}</text>
            <view class='flex flex-wrap align-center justify-between commodityList_fd2_0_c2'>
              <text class='commodityList_fd2_0_c2_c0'>{{$t('¥')}}{{item.shop_price}}</text>
              <view class='flex flex-wrap align-center justify-center commodityList_fd2_0_c2_c1'>
                <text class='commodityList_fd2_0_c2_c1_c0'>{{item.label_name}}</text>
              </view>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---商品列表_商品1flex布局结束-->
      <benben-popup v-model="popupShow1696735753286" :mask="true" :mask-close-able="true" mode='right'>
        <!---筛选弹窗flex布局开始-->
        <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout commodityList_flex_3">
          <view class='flex flex-wrap align-center justify-between commodityList_fd3_0' :style="{'margin-top':`3vh`}">
            <text class='commodityList_fd3_0_c0'>{{$t('筛选')}}</text>
          </view>
          <view class='flex flex-direction flex-wrap align-stretch flex-sub'>
            <view class='flex flex-wrap align-center justify-between commodityList_fd3_1_c0'>
              <text class='commodityList_fd3_1_c0_c0'>时间</text>
              <view class='flex flex-wrap align-center justify-around commodityList_fd3_1_c1'>
                <text class='commodityList_fd3_1_c1_c0' @tap.stop="chooseTime('1')">{{startTime || '请选择'}}</text>
              </view>
              <!-- <view class='flex flex-wrap align-center justify-between commodityList_fd3_1_c0_c1'>
                <text class='commodityList_fd3_1_c0_c1_c0' @click="getTime('7')">近7天</text>
                <text class='commodityList_fd3_1_c0_c1_c0' @click="getTime('30')">近30天</text>
              </view> -->
            </view>
            <!-- <view class='flex flex-wrap align-center justify-around commodityList_fd3_1_c1'>
              <text class='commodityList_fd3_1_c1_c0' @tap.stop="chooseTime('1')">{{startTime || '请选择'}}</text>

                <view class='flex  commodityList_fd3_1_c1_c1'></view>

              <text class='commodityList_fd3_1_c1_c0' @tap.stop="chooseTime('2')">{{endTime|| '请选择'}}</text>
            </view> -->
          </view>
          <view class='flex flex-direction flex-wrap align-stretch flex-sub'>
            <view class='flex align-center justify-center commodityList_fd3_2_c0'>
              <button class='commodityList_fd3_2_c0_c0' @tap.stop="resettingFunc()">{{$t('重置')}}</button>
              <button class='commodityList_fd3_2_c0_c1' @tap.stop="confirmFunc()">{{$t('确认')}}</button>
            </view>
          </view>
          <view class='flex flex-direction flex-wrap align-stretch flex-sub commodityList_fd3_3'>
            <view class='flex flex-wrap align-center justify-between commodityList_fd3_3_c0'>
              <text class='commodityList_fd3_1_c0_c0'>码数</text>
              <image class='commodityList_fd3_3_c0_c1' mode="aspectFit" :src='STATIC_URL+"478.png"'
                @tap.stop="showBrandFunc()" v-if=" is_showbrand===false"></image>
              <image class='commodityList_fd3_3_c0_c1' mode="aspectFit" :src='STATIC_URL+"491.png"'
                @tap.stop="showBrandFunc()" v-if=" is_showbrand===true"></image>
            </view>
            <benben-select-diy ref="showSelectPopup1714111480641"
              class-name='flex flex-wrap flex commodityList_fd3_3_c1' :items.sync="dataDrandList" v-model="brand_id"
              default-type="aid" default-label="name" :allow-cancel='true' type="radio" :disabled='false'
              v-if=" is_showbrand===true">
              <template v-for='(item,key0) in dataDrandList'>
                <view v-if="item.isSelected"
                  class='flex align-center self-center justify-center flex commodityList_fd3_3_c1_c0' :key="key0"
                  @tap="$refs.showSelectPopup1714111480641.tapHandle(key0)">
                  <text class='commodityList_fd3_3_c1_c0_c0'>{{item.name}}</text>
                </view>
                <view v-else class='flex align-center justify-center flex commodityList_fd3_3_c1_c1' :key="key0"
                  @tap="$refs.showSelectPopup1714111480641.tapHandle(key0)">
                  <text class='commodityList_fd3_3_c1_c1_c0'>{{item.name}}</text>
                </view>
              </template></benben-select-diy>
          </view>
        </view>

        <!---筛选弹窗flex布局结束-->

      </benben-popup>
      <!--选择器开始 -->
      <benben-picker ref="benbenWritePickerCodepicker4" :visible.sync="pickerDiy1714112496420" mode='date'
        :picker-height='88' :current='true' :mask-show='true' fields='day' :timeout='true' start-year='现在'
        :times.sync="startTime" end-year='2050-12-31' from-data=''>
        <template #picker-header>
          <view class='flex flex-wrap align-center justify-between commodityList_picker4_0'>
            <text @tap="$refs.benbenWritePickerCodepicker4.cancel()">取消</text>
            <text>选择时间</text>
            <text class='commodityList_picker4_0_c2' @tap="$refs.benbenWritePickerCodepicker4.pickerConfirm()">确认</text>
          </view>
        </template>
      </benben-picker>
      <!--选择器结束 -->
      <benben-picker ref="benbenWritePickerCodepicker5" :visible.sync="pickerDiy1714112496420end" mode='date'
        :picker-height='88' :current='true' :mask-show='true' fields='day' :timeout='true' start-year='现在'
        :value.sync="endTime" end-year='2050-12-31'>
        <template #picker-header>
          <view class='flex flex-wrap align-center justify-between commodityList_picker4_0'>
            <text @tap="$refs.benbenWritePickerCodepicker5.cancel()">取消</text>
            <text>选择结束时间</text>
            <text class='commodityList_picker4_0_c2' @tap="$refs.benbenWritePickerCodepicker5.pickerConfirm()">确认</text>
          </view>
        </template>
      </benben-picker>

    </view>
  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "pickerDiy1714112496420": false,
        "popupShow1696735753286": false,
        pickerDiy1714112496420end: false,
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "cut": "1",
        "brand_type": [{
          "name": "钙尔奇",
          "value": "1",
          "image": ""
        }, {
          "name": "汤臣倍健",
          "value": "2",
          "image": ""
        }, {
          "name": "哈药",
          "value": "3",
          "image": ""
        }],
        "brand_id": "",
        "price_type": [{
          "name": "0-90",
          "value": "0,90",
          "image": ""
        }, {
          "name": "100-199",
          "value": "100,199",
          "image": ""
        }, {
          "name": "200-299",
          "value": "200,299",
          "image": ""
        }, {
          "name": "300-599",
          "value": "300,599",
          "image": ""
        }, {
          "name": "599元+",
          "value": "599",
          "image": ""
        }],
        "price_id": "",
        "acut": "1",
        "goods_List": [],
        "dataDrandList": [],
        "dataShopList": [],
        "cutId": "1",
        "sort_field": "1",
        "sort_type": "desc",
        "showId": "1",
        "min_price": "",
        "max_price": "",
        "cartNum": {
          "count": ""
        },
        "money": 0,
        "areaId": "",
        "is_showbrand": true,
        "is_showprice": true,
        "keyword": "",
        "cid": "",
        "type": "0",
        startTime: '',
        endTime: '',
        name: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },
      isLogin() {
        return this.$store.state.token == '' ? false : true;
      },
      /**
       * @returns
       * Android       安卓
       * IOS       苹果
       * Web       H5 或 pc
       * Wechat       微信小程序
       * Alipay       支付宝小程序
       * Baidu       百度小程序
       * ByteBounce       抖音小程序
       * 360       360小程序
       * FastApp       快应用
       */
      appSystemIdentification() {
        return this.$store.state.appSystemIdentification
      }
    },
    watch: {},
    onLoad(options) {
      let {
        keyword,
        cid,
        type,
        name
      } = options
      if (keyword !== undefined) this.keyword = keyword
      if (name !== undefined) this.name = name
      if (cid !== undefined) this.cid = cid
      if (type !== undefined) this.type = type
      this.queryDrandListFunc()
      this.goodsListFunc()
      this.queryDrandListFunc()
      var timeStamp = new Date();
      this.riqi = this.$util.timeFormat(timeStamp)
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {},
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.goodsListFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //清空关键词
      cleanKeywordFunc() {
        this.keyword = ''
        this.goodsListFunc()
      },
      chooseTime(type) {
        console.log('ppppp', type)
        if (type == 1) {
          this.pickerDiy1714112496420 = true
        } else {
          this.pickerDiy1714112496420end = true
        }
      },
      getTime(day) {
        this.$api.post(global.apiUrls.post662deac820822, {
          day: day
        }).then(res => {
          if (res.data.code == 1) {
            this.startTime = res.data.data.start_day
            this.endTime = res.data.data.end_day
          }
        })
      },
      //获取商品列表1
      goodsListFunc() {
        // let useTime = ''
        // if (this.endTime) {
        //   useTime = this.startTime + ' - ' + this.endTime
        // }
        this.minixPagingListsApi = global.apiUrls.post64184ac1cafc3;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          keyword: this.keyword,
          goodslabel_id: this.brand_id,
          cate_id: this.cid,
          use_time: this.startTime,
        }
        this.listData = [];
        this.goods_List = this.listData;
        this.pagingListToggle();
      },

      //查询商品标签
      async queryDrandListFunc() {
        //请求方法
        //数据验证

        let datadataDrandList = await this.$api.get(global.apiUrls.post6629f826f345f, {

        });

        if (datadataDrandList.data.code != 1) {
          this.$message.info(datadataDrandList.data.msg);
          return
        }
        let infodataDrandList = datadataDrandList.data;
        this.dataDrandList = infodataDrandList.data

      },


      //顶部搜索
      topSearchFunc() {
        this.$store.commit('appSearchHistoryAdd', {
          "name": this.keyword
        })
        if (this.showId == '1') {
          this.goodsListFunc()
        } else {
          this.Func()
        }
      },

      //重置
      resettingFunc() {
        this.brand_id = '';
        this.startTime = '';
        this.endTime = '';
        this.goodsListFunc()
        this.popupShow1696735753286 = false;
      },
      //确认
      confirmFunc() {
        this.popupShow1696735753286 = false;
        this.goodsListFunc()
      },
      //显示品牌
      showBrandFunc() {
        if (this.is_showbrand === true) {
          this.is_showbrand = false;
        } else {
          this.is_showbrand = true;
        }
      },

      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .address_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .address_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
  }

  .address_fd0_0_c0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #333;
  }

  .address_fd0_0_c0 {
    width: 180rpx;
  }

  .address_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .commodityList_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .commodityList_fd0_0_c2 {
    width: 30%;
  }

  .commodityList_fd0_0_c1_c2 {
    width: 40rpx;
    height: 40rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd0_0_c1_c1 {
    font-size: 28rpx;
    font-weight: 400;
    color: var(--benbenFontColor0);
  }

  .commodityList_fd0_0_c1_c0 {
    font-size: 24rpx;
    color: rgba(153, 153, 153, 1);
    margin: 0rpx 14rpx 0rpx 0rpx;
  }

  .commodityList_fd0_0_c1 {
    background: #FFF;
    height: 64rpx;
    border-radius: 34rpx 34rpx 34rpx 34rpx;
    padding: 0rpx 24rpx 0rpx 24rpx;
    // margin: 0rpx 0rpx 0rpx 32rpx;
    width: 560rpx;
  }

  .commodityList_fd0_0_c0_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
  }

  .commodityList_fd0_0 {
    padding: 0rpx 24rpx 0rpx 24rpx;
    line-height: 88rpx;
  }

  .commodityList_flex_1 {
    background: rgba(248, 248, 248, 1);
    width: 750rpx;
    height: 100rpx;
    overflow: hidden;
    z-index: 10;
    top: 87rpx;
    background-size: 100% auto !important;
  }

  .commodityList_fd1_0_c1_c0_c1 {
    width: 30rpx;
    height: 30rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd1_0_c1_c0_c0 {
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
    margin: 0rpx 12rpx 0rpx 0rpx;
  }

  .commodityList_fd1_0_c0_c0_1 {
    font-size: 28rpx;
    font-weight: 500;
    line-height: 35rpx;
    color: var(--benbenFontColor5);
  }

  .commodityList_fd1_0_c0_c0 {
    color: var(--benbenFontColor0);
    font-size: 32rpx;
    font-weight: 500;
    line-height: 35rpx;
  }

  .commodityList_fd1_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 40rpx;
  }

  .commodityList_flex_2 {
    padding: 0rpx 0rpx 0rpx 14rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd2_0_c2_c1_c0 {
    color: rgba(20, 195, 204, 1);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 40rpx;
  }

  .commodityList_fd2_0_c2_c1 {
    background: rgba(20, 195, 204, 0.1);
    background-size: 100% auto;
    width: 40rpx;
    height: 40rpx;
    border-radius: 6rpx;
  }

  .commodityList_fd2_0_c2_c0 {
    color: var(--benbenFontColor7);
    font-size: 24rpx;
    font-weight: 700;
    line-height: 30rpx;
    margin: 8rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd2_0_c2 {
    margin: 0rpx 20rpx 18rpx 20rpx;
  }

  .commodityList_fd2_0_c1 {
    font-size: 28rpx;
    font-weight: 600;
    color: var(--benbenFontColor0);
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    line-height: 40rpx;
    height: 80rpx;
    margin: 24rpx 20rpx 16rpx 20rpx;
  }

  .commodityList_fd2_0_c0 {
    width: 346rpx;
    height: 346rpx;
    border-radius: 16rpx 16rpx 0rpx 0rpx;
  }

  .commodityList_fd2_0 {
    background: #fff;
    width: 346rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    margin: 0rpx 0rpx 10rpx 10rpx;
    padding: 0rpx 0rpx 16rpx 0rpx;
  }

  .commodityList_flex_3 {
    background: #fff;
    width: 610rpx;
    background-size: 100% auto !important;
    position: relative;
    padding: 40rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd3_3_c1_c1_c0 {
    line-height: 33rpx;
    font-size: 24rpx;
    font-weight: 600;
    color: #333333;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .commodityList_fd3_3_c1_c1 {
    background: #F8F8F8;
    width: 160rpx;
    height: 80rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    margin: 0rpx 8rpx 16rpx 8rpx;
    padding: 0rpx 20rpx 0rpx 20rpx;
  }

  .commodityList_fd3_3_c1_c0_c0 {
    line-height: 33rpx;
    font-size: 24rpx;
    font-weight: 600;
    color: #FFF;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .commodityList_fd3_3_c1_c0 {
    border: 1px solid var(--benbenbdColor2);
    background: var(--benbenbgColor7);
    width: 160rpx;
    height: 80rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    background-size: 100% auto !important;
    margin: 0rpx 8rpx 16rpx 8rpx;
    padding: 0rpx 20rpx 0rpx 20rpx;
  }

  ::v-deep .commodityList_fd3_3_c1 {
    margin: 0rpx 16rpx 28rpx 16rpx;
  }

  .commodityList_fd3_3_c0_c1 {
    width: 24rpx;
    height: 24rpx;
  }

  .commodityList_fd3_3_c0 {
    margin: 0rpx 24rpx 17rpx 32rpx;
  }

  .commodityList_fd3_3 {
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd3_2_c0_c1 {
    background: var(--benbenbgColor7);
    border-radius: 36rpx;
    font-size: 28rpx;
    color: var(--benbenFontColor3);
    width: 357rpx;
    height: 72rpx;
    line-height: 72rpx;
    margin: 0rpx 0rpx 0rpx 18rpx;
  }

  .commodityList_fd3_2_c0_c0 {
    background: rgba(181, 14, 14, 0.1);
    border-radius: 36rpx;
    font-size: 28rpx;
    color: var(--benbenFontColor7);
    width: 173rpx;
    height: 72rpx;
    line-height: 72rpx;
  }

  .commodityList_fd3_2_c0 {
    padding: 24rpx 23rpx 24rpx 23rpx;
    position: fixed;
    bottom: calc(40rpx + var(--window-bottom));
  }

  .commodityList_fd3_1_c1_c1 {
    background: rgba(153, 153, 153, 1);
    width: 50rpx;
    height: 2rpx;
    margin: 0rpx 0rpx 0rpx 0rpx;
  }

  .commodityList_fd3_1_c1_c0 {
    background: #F8F8FA;
    border-radius: 8rpx;
    width: 234rpx;
    height: 64rpx;
    line-height: 64rpx;
    text-align: center;
  }

  .commodityList_fd3_1_c1 {
    padding: 0rpx 24rpx 0rpx 24rpx;
  }

  .commodityList_fd3_1_c0_c1_c0 {
    background: #F8F8FA;
    border-radius: 8rpx;
    padding: 6rpx 12rpx 6rpx 12rpx;
  }

  .commodityList_fd3_1_c0_c1 {
    width: 220rpx;
  }

  .commodityList_fd3_1_c0_c0 {
    line-height: 45rpx;
    font-size: 27rpx;
    font-weight: 700;
    color: #333333;
  }

  .commodityList_fd3_1_c0 {
    margin: 0rpx 24rpx 24rpx 24rpx;
  }

  .commodityList_fd3_0_c0 {
    line-height: 50rpx;
    font-size: 32rpx;
    font-weight: 700;
    color: #333333;
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .commodityList_fd3_0 {
    background: #fff;
    margin: 0rpx 0rpx 24rpx 0rpx;
    height: 86rpx;
    background-size: 100% auto !important;
  }

  .commodityList_picker4_0_c2 {
    color: var(--benbenFontColor7);
  }

  .commodityList_picker4_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
    border-radius: 25rpx 25rpx 0rpx 0rpx;
    background-size: 100% auto !important;
  }
</style>
